package cn.edu.xmu.javaee.productdemo.mapper.generator;

import cn.edu.xmu.javaee.productdemo.mapper.generator.po.OnSalePo;
import cn.edu.xmu.javaee.productdemo.mapper.generator.po.OnSalePoExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface OnSalePoMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @Delete({
        "delete from goods_onsale",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @Insert({
        "insert into goods_onsale (`shop_id`, `product_id`, ",
        "`price`, `begin_time`, ",
        "`end_time`, `quantity`, ",
        "`type`, `creator_id`, ",
        "`creator_name`, `modifier_id`, ",
        "`modifier_name`, `gmt_create`, ",
        "`gmt_modified`, `max_quantity`, ",
        "`invalid`)",
        "values (#{shopId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}, ",
        "#{price,jdbcType=BIGINT}, #{beginTime,jdbcType=TIMESTAMP}, ",
        "#{endTime,jdbcType=TIMESTAMP}, #{quantity,jdbcType=INTEGER}, ",
        "#{type,jdbcType=TINYINT}, #{creatorId,jdbcType=BIGINT}, ",
        "#{creatorName,jdbcType=VARCHAR}, #{modifierId,jdbcType=BIGINT}, ",
        "#{modifierName,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, ",
        "#{gmtModified,jdbcType=TIMESTAMP}, #{maxQuantity,jdbcType=INTEGER}, ",
        "#{invalid,jdbcType=TINYINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(OnSalePo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @InsertProvider(type=OnSalePoSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(OnSalePo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @SelectProvider(type=OnSalePoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="shop_id", property="shopId", jdbcType=JdbcType.BIGINT),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.BIGINT),
        @Result(column="price", property="price", jdbcType=JdbcType.BIGINT),
        @Result(column="begin_time", property="beginTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="quantity", property="quantity", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.TINYINT),
        @Result(column="creator_id", property="creatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="creator_name", property="creatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="modifier_id", property="modifierId", jdbcType=JdbcType.BIGINT),
        @Result(column="modifier_name", property="modifierName", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="max_quantity", property="maxQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="invalid", property="invalid", jdbcType=JdbcType.TINYINT)
    })
    List<OnSalePo> selectByExample(OnSalePoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "`id`, `shop_id`, `product_id`, `price`, `begin_time`, `end_time`, `quantity`, ",
        "`type`, `creator_id`, `creator_name`, `modifier_id`, `modifier_name`, `gmt_create`, ",
        "`gmt_modified`, `max_quantity`, `invalid`",
        "from goods_onsale",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="shop_id", property="shopId", jdbcType=JdbcType.BIGINT),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.BIGINT),
        @Result(column="price", property="price", jdbcType=JdbcType.BIGINT),
        @Result(column="begin_time", property="beginTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="quantity", property="quantity", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.TINYINT),
        @Result(column="creator_id", property="creatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="creator_name", property="creatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="modifier_id", property="modifierId", jdbcType=JdbcType.BIGINT),
        @Result(column="modifier_name", property="modifierName", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="max_quantity", property="maxQuantity", jdbcType=JdbcType.INTEGER),
        @Result(column="invalid", property="invalid", jdbcType=JdbcType.TINYINT)
    })
    OnSalePo selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @UpdateProvider(type=OnSalePoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") OnSalePo row, @Param("example") OnSalePoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @UpdateProvider(type=OnSalePoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") OnSalePo row, @Param("example") OnSalePoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @UpdateProvider(type=OnSalePoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(OnSalePo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_onsale
     *
     * @mbg.generated
     */
    @Update({
        "update goods_onsale",
        "set `shop_id` = #{shopId,jdbcType=BIGINT},",
          "`product_id` = #{productId,jdbcType=BIGINT},",
          "`price` = #{price,jdbcType=BIGINT},",
          "`begin_time` = #{beginTime,jdbcType=TIMESTAMP},",
          "`end_time` = #{endTime,jdbcType=TIMESTAMP},",
          "`quantity` = #{quantity,jdbcType=INTEGER},",
          "`type` = #{type,jdbcType=TINYINT},",
          "`creator_id` = #{creatorId,jdbcType=BIGINT},",
          "`creator_name` = #{creatorName,jdbcType=VARCHAR},",
          "`modifier_id` = #{modifierId,jdbcType=BIGINT},",
          "`modifier_name` = #{modifierName,jdbcType=VARCHAR},",
          "`gmt_create` = #{gmtCreate,jdbcType=TIMESTAMP},",
          "`gmt_modified` = #{gmtModified,jdbcType=TIMESTAMP},",
          "`max_quantity` = #{maxQuantity,jdbcType=INTEGER},",
          "`invalid` = #{invalid,jdbcType=TINYINT}",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(OnSalePo row);
}